package plg.grupo1.Lexico.StateMachineHierarchy;


public class State3 implements State{
	
    private static State3 INSTANCE = null;    
	private State3(){}
	
    private synchronized static void createInstance() {
        if (INSTANCE == null) INSTANCE = new State3();
    }
    
    public static State3 getInstance() {
        if (INSTANCE == null) createInstance();
        return INSTANCE;
    }

	public void goNext(){
		
		if(Contexto.isEof())
			Contexto.genErrorAndGoToInitialState("EOF","'Character'");
		else{	
			
			char c = Contexto.getCharAndMoveToNext();//A
			Contexto.appendToLexema(c);//B
			
			if(c=='\'') 
				Contexto.setCurrentState(State5.getInstance()); 
			else if("|~-_:*".indexOf(c)!=-1) 
				Contexto.setCurrentState(State7.getInstance());
			else if("{}\\".indexOf(c)!=-1) 
				Contexto.setCurrentState(State14.getInstance());
			else if(Character.toLowerCase(c)>='a' && Character.toLowerCase(c)<='z')
				Contexto.setCurrentState(State8.getInstance());
			else
				Contexto.genErrorAndGoToInitialState(Character.toString(c),"ALL~[NUMEROS,' ',SIMBOLOS_NO_LETRA]");
		}
	}
}
